#ifndef DATASERVER_PARSER_H
#define DATASERVER_PARSER_H

#include "fcgiapp.h"
#include "fs_types.h"

typedef struct parser_struc
{
    char query_string[1024];
    char script_name[1024];
    char storage[1024];
    char *content;
    int  content_length;
    int  cmd;
    
    DIR_ID _parentid;
    char _name[MAX_FILENAME];
    char _newname[MAX_FILENAME];
}ParserStruc;

int parser_cmd_param(ParserStruc *pstruc, const char *cmdkey, char *value, int value_size);

int parser_cmd_readfile_param(ParserStruc *pstruc, uint32_t& version, uint32_t& offset, uint32_t& length); 

int parser_cmd_lsdir_param(ParserStruc *pstruc, int& mode);
  
int parser_cmd_recover_param(ParserStruc *pstruc, int& type);

int parser_storage_cmd(ParserStruc *pstruc);

int parser_requ_env(FCGX_Request *request, ParserStruc *pstruc);

ParserStruc* parser_init();
void parser_destroy(ParserStruc *pstruc);
#endif
